package service.interf;

import java.util.List;

import dao.pojo.Group;

import model.MAuthority;
import model.MGroup;

public interface IAuthority {
	/************ GROUP *********/
	// 添加组
	public String addGroup(MGroup model) throws Exception; 

	// 删除组
	public String delGroup(Integer groupId) throws Exception; 
	
	//批量保存组
	public String batchUpdateGroup(String datas) throws Exception;
	
	/********* AUTHORITY *******************/
	// 添加权限
	public String addAuthority(MAuthority model) throws Exception; 

	// 删除权限
	public String delAuthority(String aname) throws Exception; 

	//批量保存
	public String batchUpdateAuthority(String datas) throws Exception;
	
	/********** GROUP_AUTHORITY ************/
	//添加组权限
	public String addGroupAuthorities(Integer groupId, String authorities)
			throws Exception;

	// 删除组权限
	public String delGroupAuthority(Integer groupId, String authorities)
			throws Exception; 

	// 删除组所有权限
	public String delGroupAllAuthority(Integer groupId) throws Exception; 

	// 更新组权限
	public String updateGroupAuthority(Integer groupId, String authorities)
			throws Exception; 

	
	
	/************* GROUP_MEMBER *********************/
	// 添加用户到多个组
	public String addUserToGroups(Integer userId, String groups)
			throws Exception; 
	
	//添加用户到组（组名）
	public String addUserToGroup(Integer userId, String groupName) throws Exception;
	
	//添加多用户到某组
	public String addUsersToGroup(String users, Integer groupId) 
		throws Exception;     
	
	// 从多个组删除用户
	public String removeUserFromGroups(Integer userId, String groups)
			throws Exception;
	
	//从单个组删除用户
	public String removeUsersFromGroup(String users, Integer groupId) 
		throws Exception; 

	//从单个组删除单个用户
	public String removeUserFromGroup(Integer userId, Integer groupId) 
	throws Exception; 
	
	// 删除用户所有组
	public String removeUserGroups(Integer userId) throws Exception; 

	// 获取用户所有组
	public String getUserGroups(Integer userId) throws Exception;
	public String getUserGroups(String userName) throws Exception;

	// 更新用户组
	public String updateUserGroups(String userName, String groups)
			throws Exception; 
	
	//更新组用户
	public String updateGroupUsers(String users, Integer groupId) 
		throws Exception;     
	
	// 获取所有权限
	public String getAllAuthorities(int page,int rows) throws Exception; 

	// 获取所有组
	public String getAllGroups(int page,int rows) throws Exception; 

	// 获取所有组并带权限
	public String getAllGroupsWithAuthority() throws Exception; 

	// 获取组用户
	public String getGroupUsers(Integer groupId) throws Exception; 
	
	 //获取组用户(带细节)
	public String getGroupUsersDetail(Integer groupId,int pageno,int pagesize) throws Exception;
	
	//获取组权限
	public String getAuthsByGroup(Integer groupId) throws Exception;
	
	//获取用户权限
	public String getAuthoritiesByUser(Integer userId) throws Exception;
	
	//获取权限用户
	public String getUsersByAuthority(Integer authId) throws Exception;
	
	//检验用户是否有权限
	public boolean isUserHasAuthority(Integer userId, String auth) throws Exception;
}
